`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: 
// Engineer: 
// 
// Create Date:    14:46:06 02/01/2014 
// Design Name: 
// Module Name:    pseudo_thermal 
// Project Name: 
// Target Devices: 
// Tool versions: 
// Description: 
//
// Dependencies: 
//
// Revision: 
// Revision 0.01 - File Created
// Additional Comments: 
//
//////////////////////////////////////////////////////////////////////////////////
module pseudo_thermal(
    input [7:0] pixel_data,
	 input clock,
	 input empty,
	 output reg ready,
    output reg [7:0] pt_red_p,
    output reg [7:0] pt_green_p,
    output reg [7:0] pt_blue_p
    );
	 
//reg ready = 1'b0;
//assign ready = ready;
initial begin
	ready <= 1'b1;
end

reg byte_counter = 0;
//MAKE CHANGES WITH RESPECT TO FIFO EMPTY SIGNAL
always @(posedge clock) begin	
		if(empty) begin
			ready <= 1'b0;
		end
		else begin
			ready <= 1'b1;
		end
		
		if(ready) begin
			if (byte_counter == 1)begin
				if(pixel_data > 8'd250) begin 
					pt_red_p <= 8'd250;
					pt_green_p <= 8'd8;
					pt_blue_p <= 8'd8;
				end 
				
				else if((pixel_data >= 8'd190)&&(pixel_data < 8'd250)) begin
					pt_red_p <= 8'd255;
					pt_green_p <= 8'd61;
					pt_blue_p <= 8'd8;
				end
				
				else if((pixel_data >= 8'd170)&&(pixel_data < 8'd190)) begin
					pt_red_p <= 8'd252;
					pt_green_p <= 8'd80;
					pt_blue_p <= 8'd0;
				end 
				//Yellows
				else if((pixel_data >= 8'd150)&&(pixel_data < 8'd170)) begin
					pt_red_p <= 8'd252;
					pt_green_p <= 8'd173;
					pt_blue_p <= 8'd0;
				end 
				
				else if((pixel_data >= 8'd130)&&(pixel_data < 8'd150)) begin
					pt_red_p <= 8'd252;
					pt_green_p <= 8'd224;
					pt_blue_p <= 8'd0;
				end 
				
				else if((pixel_data >= 8'd90)&&(pixel_data < 8'd130)) begin
					pt_red_p <= 8'd248;
					pt_green_p <= 8'd252;
					pt_blue_p <= 8'd0;
				end 
				//Blues
				else if((pixel_data >= 8'd80)&&(pixel_data < 8'd90))begin
					pt_red_p <= 8'd0;
					pt_green_p <= 8'd237;
					pt_blue_p <= 8'd160;
				end 
				
				else if((pixel_data >= 8'd70)&&(pixel_data < 8'd80))begin
					pt_red_p <= 8'd30;
					pt_green_p <= 8'd127;
					pt_blue_p <= 8'd250;
				end 
				
				else if((pixel_data >= 8'd50)&&(pixel_data < 8'd70))begin
					pt_red_p <= 8'd30;
					pt_green_p <= 8'd79;
					pt_blue_p <= 8'd250;
				end 
				
				else if((pixel_data >= 8'd30)&&(pixel_data < 8'd50))begin
					pt_red_p <= 8'd59;
					pt_green_p <= 8'd59;
					pt_blue_p <= 8'd59;
				end 
				
				else if (pixel_data < 30) begin
					pt_red_p <= 8'd61;
					pt_green_p <= 8'd0;
					pt_blue_p <= 8'd206;
				end
				
				byte_counter <= 0;
			end
			
			else begin
				byte_counter <= byte_counter + 1'b1;
			end
		end

end
endmodule